home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / pangomm-1.4 / pangomm / rectangle.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-04-20  |  5.3 KB  |  164 lines

  1. // -*- c++ -*-
  2. // Generated by gtkmmproc -- DO NOT MODIFY!
  3. #ifndef _PANGOMM_RECTANGLE_H
  4. #define _PANGOMM_RECTANGLE_H
  5.  
  6. #include <glibmm.h>
  7.  
  8. /* Copyright (C) 2002 The gtkmm Development Team
  9.  *
  10.  * This library is free software; you can redistribute it and/or
  11.  * modify it under the terms of the GNU Library General Public
  12.  * License as published by the Free Software Foundation; either
  13.  * version 2 of the License, or (at your option) any later version.
  14.  *
  15.  * This library is distributed in the hope that it will be useful,
  16.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  18.  * Library General Public License for more details.
  19.  *
  20.  * You should have received a copy of the GNU Library General Public
  21.  * License along with this library; if not, write to the Free
  22.  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  23.  */
  24.  
  25. #include <pango/pango-types.h>
  26.  
  27.  
  28. namespace Pango
  29. {
  30.  
  31. /** A Pango::Rectangle represents a rectangle.
  32.  * It is frequently used to represent the logical or ink extents of a single glyph or section of text.
  33.  * The coordinate system for each rectangle has its origin at the base line and the horizontal
  34.  * origin of the character with increasing coordinates extending to the right and down.
  35.  * get_ascent(), get_descent(), get_lbearing(), and get_rbearing() can be used to convert
  36.  * from the extents rectangle to more traditional font metrics.
  37.  * The units of rectangles usually are in 1/Pango::SCALE of a device unit.
  38.  */
  39. class Rectangle
  40. {
  41.   public:
  42. #ifndef DOXYGEN_SHOULD_SKIP_THIS
  43.   typedef Rectangle CppObjectType;
  44.   typedef PangoRectangle BaseObjectType;
  45. #endif /* DOXYGEN_SHOULD_SKIP_THIS */
  46.  
  47. private:
  48.  
  49.  
  50. public:
  51.   Rectangle();
  52.   Rectangle(int x, int y, int width, int height);
  53.   explicit Rectangle(const PangoRectangle* src);
  54.  
  55.   /** Sets the X coordinate of the left side of the rectangle.
  56.    * @param x The new X coordinate.
  57.    */
  58.   void set_x(int x)        { gobject_.x = x; }
  59.  
  60.   /** Sets the Y coordinate of the top side of the rectangle.
  61.    * @param y The new Y coordinate.
  62.    */
  63.   void set_y(int y)        { gobject_.y = y; }
  64.  
  65.   /** Sets the width of the rectangle.
  66.    * @param w The new width.
  67.    */
  68.   void set_width(int w)    { gobject_.width = w; }
  69.  
  70.   /** Sets the height of the rectangle.
  71.    * @param h The new height.
  72.    */
  73.   void set_height(int h)   { gobject_.height = h; }
  74.  
  75.   /** Gets the X coordinate of the left side of the rectangle.
  76.    * @return The X coordinate.
  77.    */
  78.   int get_x() const        { return gobject_.x; }
  79.  
  80.   /** Gets the Y coordinate of the top side of the rectangle.
  81.    * @return The Y coordinate.
  82.    */
  83.   int get_y() const        { return gobject_.y; }
  84.  
  85.   /** Gets the width of the rectangle.
  86.    * @return The width.
  87.    */
  88.   int get_width() const    { return gobject_.width; }
  89.  
  90.   /** Gets the height of the rectangle.
  91.    * @return The height.
  92.    */
  93.   int get_height() const   { return gobject_.height; }
  94.  
  95.   /** Extracts the ascent from a Pango::Rectangle representing glyph extents.
  96.    * The ascent is the distance from the baseline to the highest point of the character.
  97.    * This is positive if the glyph ascends above the baseline.
  98.    * @return The ascent of the character.
  99.    */
  100.   int get_ascent() const   { return PANGO_ASCENT(*gobj()); }
  101.  
  102.   /** Extracts the descent from a Pango::Rectangle representing glyph extents.
  103.    * The descent is the distance from the baseline to the lowest point of the character.
  104.    * This is positive if the glyph descends below the baseline.
  105.    * @return The descent of the character.
  106.    */
  107.   int get_descent() const  { return PANGO_DESCENT(*gobj()); }
  108.  
  109.   /** Extracts the left bearing from a Pango::Rectangle representing glyph extents.
  110.    * The left bearing is the distance from the horizontal origin to the farthest left point of the character.
  111.    * This is positive for characters drawn completely to the right of the glyph origin.
  112.    * @return The left bearing of the character.
  113.    */
  114.   int get_lbearing() const { return PANGO_LBEARING(*gobj()); }
  115.  
  116.   /** Extracts the right bearing from a Pango::Rectangle representing glyph extents.
  117.    * The right bearing is the distance from the horizontal origin to the farthest right point of the character.
  118.    * This is positive except for characters drawn completely to the left of the horizontal origin.
  119.    * @return The right bearing of the character.
  120.    */
  121.   int get_rbearing() const { return PANGO_RBEARING(*gobj()); }
  122.  
  123.   /** Checks for equality of two Pango::Rectangles.
  124.    * @param rhs The Pango::Rectangle to compare with.
  125.    * @return true if @a rhs is equal with the rectangle.
  126.    */
  127.   bool equal(const Rectangle& rhs) const;
  128.  
  129.   /// Provides access to the underlying C GObject.  
  130.   PangoRectangle*       gobj()       { return &gobject_; }
  131.   /// Provides access to the underlying C GObject.
  132.   const PangoRectangle* gobj() const { return &gobject_; }
  133.  
  134. protected:
  135.   PangoRectangle gobject_;
  136.  
  137.  
  138. };
  139.  
  140. /** @relates Pango::Rectangle */
  141. inline bool operator==(const Rectangle& lhs, const Rectangle& rhs)
  142.   { return lhs.equal(rhs); }
  143.  
  144. /** @relates Pango::Rectangle */
  145. inline bool operator!=(const Rectangle& lhs, const Rectangle& rhs)
  146.   { return !lhs.equal(rhs); }
  147.  
  148. } /* namespace Pango */
  149.  
  150.  
  151. namespace Glib
  152. {
  153.  
  154. /** @relates Pango::Rectangle */
  155. Pango::Rectangle& wrap(PangoRectangle* object);
  156.  
  157. /** @relates Pango::Rectangle */
  158. const Pango::Rectangle& wrap(const PangoRectangle* object);
  159.  
  160. } /* namespace Glib */
  161.  
  162. #endif /* _PANGOMM_RECTANGLE_H */
  163.  
  164.